# -*- coding: iso-8859-2 -*- 

import os
import subprocess

##os.startfile("C:\Documents and Settings\flow_model\flow.exe")
#os.startfile("spust2pokus.bat")
#print('Spusteni souboru 1 probehlo uspesne!\n')

nazev_in_souboru = 'Ciste_zadani.txt' 
print("IN file:  " + nazev_in_souboru)

try:
    souborIN=open(nazev_in_souboru,'r')
except:
    print('CHYBA: Soubor "', nazev_in_souboru, '" nenalezen!!!\n')

for radek in souborIN:
    print(radek.split(",")[0])
    print(radek.split(",")[1].rstrip())
    print(radek.split(",")[1].rstrip().replace(";", ","));
    argument2 = radek.split(",")[1].rstrip() #.replace(";", ",")
    argument2 = argument2.replace('"', '"')
    argument2 = '"' + argument2.replace('"', '"') + '"'
    argument2 = argument2.replace("'", "")
    print(argument2)
    print(radek.split(",")[1].rstrip().split("'")[1])
    print("*****************")
    subprocess.check_call(["spust-calc-3-arg.bat", radek.split(",")[0], argument2])

#subprocess.check_call(["Kalkulacka 3 pomoci stavu 6 args.py", "PARAM_1-FileName", "PARAM_2-Solutions"])


#subprocess.check_call(["spust-calc-3-arg-POKUS-VYPIS.bat", radek.split(",")[0], radek.split(",")[1].rstrip().split("'")[1]])
#subprocess.check_call(["spust-calc-3-arg.bat", radek.split(",")[0], radek.split(",")[1].rstrip().split("'")[1]])
print('Spusteni souboru 2 probehlo uspesne!\n')


